<%-- 
    Document   : ScribdView
    Created on : Apr 21, 2011, 4:39:01 PM
    Author     : Tiong Jia Ming
    Admin No   : 0900960
    Class      : DISM/FT/2A/02
--%>

<%@page import="File.Scribd"%>
<%@page import="DB.DBConnectionJm"%>
<%@page import="java.io.InputStreamReader"%>
<%@page import="java.io.BufferedReader"%>
<%@page import="java.io.InputStream"%>
<%@page import="java.net.HttpURLConnection"%>
<%@page import="java.net.URL"%>
<%@page import="javax.xml.*"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<script type="text/javascript>">

</script>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <%
                    Scribd scribd = new Scribd();
                    String fileID = request.getParameter("id").toString();
                    String key = scribd.viewOnlineDoc(fileID);
                    out.println("<script type='text/javascript' src='http://www.scribd.com/javascripts/view.js'></script>");
                    out.println("<div id='embedded_flash'><a href=\"http://www.scribd.com\">Scribd</a></div>");

                    out.println("<script type=\"text/javascript\">");
                    out.println("var scribd_doc = scribd.Document.getDoc(" + fileID + ", '" + key + "' );");
                    out.println("var oniPaperReady = function(e){");
                    out.println("// scribd_doc.api.setPage(3);");
                    out.println("}");

                    out.println("scribd_doc.addParam( 'jsapi_version', 1 );");
                    out.println("scribd_doc.addEventListener( 'iPaperReady', oniPaperReady );");
                    out.println("scribd_doc.write( 'embedded_flash' );");
                    out.println("</script>");
        %>
    </body>
</html>
